package nail

import (
	requset "back/router/request"
	"github.com/gin-gonic/gin"
	"utilx/rox"
)

// java class // mvc

// LOGIN
func (u NailMember) login() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		var temp requset.LoginReq
		if rox.BindBoyJsonErr[requset.LoginReq](ctx, &temp) {
			return
		}
		//Next -->
		data, err := u.srv.Login(temp)
		if err != nil {
			rox.HandleErr[string](ctx, "login err", err.Error())
			return
		}
		rox.HandleSuccess[any](ctx, "login success", data)
	}
}
